// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_activity;

import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.GestureDetector;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.webkit.URLUtil;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.nnee.p_img.p_video.cls_MonitoredActivity;
import com.nnee.p_imgex.cls_ImageViewTouch;
import com.nnee.p_i.cls_c;
import com.nnee.p_pr.p_activity.p_view.cls_n;
import com.nnee.p_pr.p_activity.p_view.cls_w;
import com.nnee.p_pr.p_app.cls_PrisApp;
import com.nnee.p_pr.p_atom.p_b.cls_a;
//import com.nnee.p_pr.p_d.cls_c;
import com.nnee.p_pr.cls_v;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

// Referenced classes of package com.nnee.p_pr.p_activity:
//            gd, PRISActivityGuide, MainGridActivity, gc, 
//            at

public class cls_PRISActivityFlasScreen extends cls_MonitoredActivity
    implements cls_w
{

    public cls_PRISActivityFlasScreen()
    {
        a = new ArrayList();
        b = new ArrayList();
        p = false;
    }

    static Bitmap a(Context context, String s)
    {
        Bitmap bitmap = null;
        if(context != null && !TextUtils.isEmpty(s)) {
        	AssetManager assetmanager = context.getAssets();
            InputStream inputstream = null;
			try {
				inputstream = assetmanager.open(s);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            Object obj = inputstream;
            Bitmap bitmap1 = BitmapFactory.decodeStream(((InputStream) (obj)));
            bitmap = bitmap1;
            if(obj != null)
                try
                {
                    ((InputStream) (obj)).close();
                }
                catch(IOException ioexception3)
                {
                    ioexception3.printStackTrace();
                }
        }
 
        return bitmap;
 
    }

    private Bitmap a(Uri uri)
    {
    	Bitmap bitmap;
    	
        if(!URLUtil.isAssetUrl(uri.toString())) {
        	Bitmap bitmap1 = BitmapFactory.decodeFile(uri.getPath());
            bitmap = bitmap1;
        } else {
        	String s = uri.toString().substring("file:///android_asset/".length());
            bitmap = a(((Context) (cls_PrisApp.a())), s);
        }
 
        return bitmap;
    }

    static Bitmap a(cls_PRISActivityFlasScreen prisactivityflasscreen, Uri uri)
    {
        return prisactivityflasscreen.a(uri);
    }

    private void a(int i1)
    {
        Uri uri;
        cls_a a1;
        uri = (Uri)b.get(i1);
        a1 = (cls_a)a.get(i1);
        if(uri == null) {
        	if(!j && b.size() > 1)
            {
                int j1 = (i1 + 1) % b.size();
                c.postDelayed(new cls_gd(this, j1), 3000L);
            }
        } else {
        	Bitmap bitmap = a(uri);
            if(bitmap == null) {
            	if(!j && b.size() > 1)
                {
                    int j1 = (i1 + 1) % b.size();
                    c.postDelayed(new cls_gd(this, j1), 3000L);
                }
            } else {
            	a(i1, bitmap, a1, 3000L);
            }
        }
 
    }

    private void a(int i1, Bitmap bitmap)
    {
        Uri uri;
        long l1;
        uri = (Uri)b.get(i1);
        l1 = 3000L;
        if(uri == null) {
        	if(!j)
                if(h)
                    c.postDelayed(new cls_gd(this, i1), l1);
                else
                if(b.size() > 1)
                {
                    int j1 = (i1 + 1) % b.size();
                    c.postDelayed(new cls_gd(this, j1), l1);
                }
        } else {
        	 if(bitmap == null) {
        		 l1 = 500L;
        		 
        		 if(!j)
                     if(h)
                         c.postDelayed(new cls_gd(this, i1), l1);
                     else
                     if(b.size() > 1)
                     {
                         int j1 = (i1 + 1) % b.size();
                         c.postDelayed(new cls_gd(this, j1), l1);
                     }
        	 }else {
        		 a(i1, bitmap, (cls_a)a.get(i1), l1);
        	 }
        }
 
    }

    private void a(int i1, Bitmap bitmap, cls_a a1, long l1)
    {
        ViewGroup viewgroup = (ViewGroup)d.inflate(0x7f030004, null);
        viewgroup.setVisibility(4);
        ((cls_ImageViewTouch)viewgroup.findViewById(0x7f0d0012)).a(bitmap, true, true);
        if(a1 != null)
        {
            ((TextView)viewgroup.findViewById(0x7f0d0013)).setText(a1.d());
            ((TextView)viewgroup.findViewById(0x7f0d0014)).setText(a1.e());
            if(!TextUtils.isEmpty(a1.f()))
                ((TextView)viewgroup.findViewById(0x7f0d0015)).setText((new StringBuilder()).append(getString(0x7f0a01ff)).append(a1.f()).toString());
            l1 = 1000 * a1.g();
            if(l1 <= 0L)
                l1 = 3000L;
        }
        e.addView(viewgroup, 0);
        f.a(viewgroup);
        if(!j && l1 >= 0L && b.size() > 1)
        {
            int j1 = (i1 + 1) % b.size();
            c.postDelayed(new cls_gd(this, j1), l1);
        }
    }

    public static void a(Context context)
    {
        Intent intent = new Intent(context, com.nnee.p_pr.p_activity.cls_PRISActivityFlasScreen.class);
        intent.putExtra("start_by_slide", true);
        context.startActivity(intent);
    }

    static void a(cls_PRISActivityFlasScreen prisactivityflasscreen)
    {
        prisactivityflasscreen.d();
    }

    static void a(cls_PRISActivityFlasScreen prisactivityflasscreen, int i1)
    {
        prisactivityflasscreen.a(i1);
    }

    static void a(cls_PRISActivityFlasScreen prisactivityflasscreen, int i1, Bitmap bitmap)
    {
        prisactivityflasscreen.a(i1, bitmap);
    }

    private void b()
    {
        boolean flag;
        if(!h)
            flag = true;
        else
            flag = false;
        h = flag;
    }

    static void b(cls_PRISActivityFlasScreen prisactivityflasscreen)
    {
        prisactivityflasscreen.c();
    }

    private void c()
    {
        String s = com.nnee.p_pr.p_a.cls_e.b(cls_PrisApp.a());
        if(com.nnee.p_pr.p_b.cls_a.n())
        {
            com.nnee.p_pr.p_b.cls_a.I(s);
            Intent intent1 = new Intent(this, com.nnee.p_pr.p_activity.cls_PRISActivityGuide.class);
            intent1.putExtra("update", false);
            startActivity(intent1);
        } else
        if(com.nnee.p_pr.p_b.cls_a.h(s))
        {
            com.nnee.p_pr.p_b.cls_a.I(s);
            Intent intent = new Intent(this, com.nnee.p_pr.p_activity.cls_PRISActivityGuide.class);
            intent.putExtra("update", true);
            startActivity(intent);
        } else
        if(com.nnee.p_pr.p_b.cls_a.c() == null)
            com.nnee.p_pr.p_activity.cls_MainGridActivity.a(this, 0, 1);
        else
            com.nnee.p_pr.p_activity.cls_MainGridActivity.a(this, 7, 1);
        finish();
    }

    private void d()
    { List list;
//    int i1;
//    int j1;
//        File file;
//        a.clear();
//        b.clear();
//        file = new File(com.nnee.p_pr.p_c.cls_a.a());
//        if(!file.exists()) {
//        	e();
//        	return;
//        } else {
//        	 File afile[] = file.listFiles();
//             if(afile == null || afile.length <= 0) {
//             	e();
//            	return;
//            }  else {
//            	 list = com.nnee.p_pr.p_c.cls_a.a(this);
//                 i1 = afile.length;
//                 j1 = 0;
//                 
//                 if(j1 >= i1) {return;} else {
//                	 String s;
//                     Iterator iterator;
//                     b.add(Uri.fromFile(afile[j1]));
//                     s = afile[j1].getName();
//                     if(list == null)
//                         return;
//                     iterator = list.iterator();
//                     
//                     if(!iterator.hasNext()) {
//                    	 a1 = null;
//                    	 
//                     } else goto _L6
//                     
//                 }
//            }
//        }
//_L1:
//        File afile[] = file.listFiles();
//        if(afile == null || afile.length <= 0) goto _L2; else goto _L3
//_L3:
//       
//        list = com.nnee.p_pr.p_c.cls_a.a(this);
//        i1 = afile.length;
//        j1 = 0;
//_L10:
//        if(j1 >= i1) goto _L5; else goto _L4
//_L4:
//        String s;
//        Iterator iterator;
//        b.add(Uri.fromFile(afile[j1]));
//        s = afile[j1].getName();
//        if(list == null)
//            break MISSING_BLOCK_LABEL_193;
//        iterator = list.iterator();
//_L9:
//        if(!iterator.hasNext()) goto _L7; else goto _L6
//_L6:
//        cls_a a1 = (cls_a)iterator.next();
//        if(a1.c() == null || !a1.c().endsWith(s)) goto _L9; else goto _L8
//_L8:
//        if(a1 != null)
//            list.remove(a1);
//_L11:
//        a.add(a1);
//        j1++;
//          goto _L10
//_L2:
//        e();
//_L5:
//        return;
//_L7:
//        a1 = null;
//          goto _L8
//        a1 = null;
//          goto _L11
    }

    private void e()
    {
        AssetManager assetmanager;
        a.clear();
        b.clear();
        assetmanager = getAssets();
        String as[] = null;
        int i1;
        try {
			as = assetmanager.list("conver");
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
        i1 = 0;
while(true){
        if(i1 >= as.length)
            return;
        b.add(Uri.parse((new StringBuilder()).append("file:///android_asset/conver/").append(as[i1]).toString()));
        a.add(null);
        i1++;
}
    }

    public void a(View view)
    {
    }

    protected void onCreate(Bundle bundle)
    {
        super.onCreate(bundle);
        p = getIntent().getBooleanExtra("start_by_slide", false);
        setDefaultKeyMode(2);
        requestWindowFeature(1);
        setContentView(0x7f03003b);
        d = (LayoutInflater)getSystemService("layout_inflater");
        e = (FrameLayout)findViewById(0x7f0d0011);
        f = new cls_n(this, e, null);
        f.a(this);
        c = new Handler();
        g = new GestureDetector(new cls_gc(this, (int)(40F * getResources().getDisplayMetrics().density)));
        i = new cls_at(this);
        i.execute(new Void[0]);
    }

    protected void onDestroy()
    {
        super.onDestroy();
        if(i != null)
        {
            i.cancel(true);
            i = null;
        }
    }

    public boolean onKeyDown(int i1, KeyEvent keyevent)
    {
        if(i1 == 4 && !p)
            getWindow().setWindowAnimations(o);
        return super.onKeyDown(i1, keyevent);
    }

    protected void onResume()
    {
        if(cls_PrisApp.a().t() == 0)
            cls_v.a().o();
        o = getWindow().getAttributes().windowAnimations;
        getWindow().setWindowAnimations(0x7f0b000e);
        super.onResume();
        com.nnee.p_pr.p_d.cls_c.b(a());
    }

    public void onStop()
    {
        super.onStop();
        j = true;
    }

    public boolean onTouchEvent(MotionEvent motionevent)
    {
        return g.onTouchEvent(motionevent);
    }

    private static final int k = 3000;
    private static final int l = 40;
    private static final String m = "start_by_slide";
    private static final String n = "PRISActivityFlasScreen";
    List a;
    List b;
    Handler c;
    LayoutInflater d;
    FrameLayout e;
    cls_n f;
    GestureDetector g;
    boolean h;
    AsyncTask i;
    boolean j;
    private int o;
    private boolean p;
}
